#include "SystemVshm.hpp"

//读取端

int main() //在服务端满足的情况下可无限启动连接空余管道
{
    int i = 0;
    cout<<"请输入连接端口> ";
    cin>>i;
    SHM_SERVER<char> s(i);
    while(true)
    {
        char str[2] = {0};
        int n = read(s.r_fd(),str,1);
        if(n == 1 && str[0] == '1')
        {
            cout<<"服务端" << i << ">> "<<s()<<endl;
        }
        if(strcasecmp(str,"0") == 0) break;
        sleep(1);
    }

    return 0;
}